﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TP3Master.master" AutoEventWireup="true" CodeFile="frmProgramacion.aspx.cs" Inherits="Espectaculos_Gestion_frmProgramacion" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">

    <br />
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <table border='1' align="center" style="border: 1 solid black" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <asp:DropDownList ID="ddlMes" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlMes_SelectedIndexChanged">
                    <asp:ListItem Text="Enero" Value="1" />
                    <asp:ListItem Text="Febrero" Value="2" />
                    <asp:ListItem Text="Marzo" Value="3" />
                    <asp:ListItem Text="Abril" Value="4" />
                    <asp:ListItem Text="Mayo" Value="5" />
                    <asp:ListItem Text="Junio" Value="6" />
                    <asp:ListItem Text="Julio" Value="7" />
                    <asp:ListItem Text="Agosto" Value="8" />
                    <asp:ListItem Text="Setiembre" Value="9" />
                    <asp:ListItem Text="Octubre" Value="10" />
                    <asp:ListItem Text="Noviembre" Value="11" />
                    <asp:ListItem Text="Diciembre" Value="12" />
                </asp:DropDownList>
            </td>
            <td>
                <asp:DropDownList ID="ddlAnio" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlAnio_SelectedIndexChanged">
                    <asp:ListItem Text="2013" Value="2013" />
                    <asp:ListItem Text="2014" Value="2014" />
                </asp:DropDownList>
            </td>
        </tr>
    </table>
    <br />

        <asp:UpdatePanel ID="upnlCal" runat="server" >
        <ContentTemplate>
    <asp:Literal ID="ltrCalendar" runat="server"></asp:Literal>

        <asp:Table ID="tblCalendario" runat="server" BorderColor="Black" BorderStyle="Solid"   BorderWidth="1" HorizontalAlign="Center" CellSpacing="0" CellPadding="0" Font-Size="Larger" Width="700px" >
            <asp:TableHeaderRow  CssClass="CabTabla"  HorizontalAlign="Center" >
                <asp:TableHeaderCell >Dom</asp:TableHeaderCell>
                <asp:TableHeaderCell >Lun</asp:TableHeaderCell>
                <asp:TableHeaderCell >Mar</asp:TableHeaderCell>
                <asp:TableHeaderCell >Mie</asp:TableHeaderCell>
                <asp:TableHeaderCell >Jue</asp:TableHeaderCell>
                <asp:TableHeaderCell >Vie</asp:TableHeaderCell>
                <asp:TableHeaderCell >Sab</asp:TableHeaderCell>
        </asp:TableHeaderRow>

</asp:Table>

       </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ddlMes" EventName="SelectedIndexChanged" />
            <asp:AsyncPostBackTrigger ControlID="ddlAnio" EventName="SelectedIndexChanged" />
<%--            <asp:AsyncPostBackTrigger ControlID="btnCargarGrid" EventName="Click" />--%>
        </Triggers>
    </asp:UpdatePanel>
    <br />
    <asp:Button ID="Button1" runat="server" Text="Button" Style="display: none" />
    <asp:ModalPopupExtender ID="mpeProgView" runat="server" CancelControlID="btnCancel"
        TargetControlID="Button1" PopupControlID="pnlView" PopupDragHandleControlID="PopupHeader"
        Drag="true" BackgroundCssClass="ModalPopupBG">
    </asp:ModalPopupExtender>
    <asp:Panel ID="pnlView" Style="display: none" runat="server">
        <div class="HellowWorldPopup">
            <div class="popup_Titlebar" id="PopupHeader">
                <div class="TitlebarLeft">
                    <asp:Label ID="lblTitulo" runat="server" Style="font: bold; color: White;" Text=""></asp:Label>
                </div>
                <div class="TitlebarRight" onclick="$get('btnCancel').click();">
                </div>
            </div>
            <asp:Label ID="lblVal" runat="server" Style="font: bold; color: black;"></asp:Label>
            <asp:HiddenField ID="hdFecha" runat="server" />
            <br />
            <div align="center">
                 <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:GridView ID="grvEspec" runat="server" BackColor="White" AutoGenerateColumns="False"
                        BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" OnRowDataBound="grvEspec_RowDataBound"
                        DataKeyNames="IdEspectaculo,Fecha" EmptyDataText="No se han programado espectáculos para esta fecha." >
                        <Columns>
                            <asp:BoundField DataField="Nombre" HeaderText="Espectáculo" />
                            <asp:BoundField DataField="Descripcion" HeaderText="Descripcion" />
                            <asp:BoundField DataField="Estado" HeaderText="Estado" />
                            
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:ImageButton ID="ibtnEditar" runat="server" ImageUrl="~/Images/botones/fileedit.gif"
                                        OnClick="ibtnEditar_Click" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:ImageButton ID="ibtnEliminar" runat="server" ImageUrl="~/Images/botones/filedelete.gif"
                                        OnClick="ibtnEliminar_Click" />
                                    <asp:ConfirmButtonExtender ID="ibtnEliminar_ConfirmButtonExtender" runat="server"
                                        ConfirmText="Está seguro de eliminar el registro?" Enabled="True" TargetControlID="ibtnEliminar">
                                    </asp:ConfirmButtonExtender>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
                        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
                        <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                        <RowStyle BackColor="White" ForeColor="#330099" />
                        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                        <SortedAscendingCellStyle BackColor="#FEFCEB" />
                        <SortedAscendingHeaderStyle BackColor="#AF0101" />
                        <SortedDescendingCellStyle BackColor="#F6F0C0" />
                        <SortedDescendingHeaderStyle BackColor="#7E0000" />
                    </asp:GridView>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnCargarGrid" EventName="Click" />
                   <%-- <asp:AsyncPostBackTrigger ControlID="ddlMes" EventName="SelectedIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="ddlAnio" EventName="SelectedIndexChanged" />--%>
                  <%--  <asp:AsyncPostBackTrigger ControlID="grvEspec" EventName="RowCommand" />--%>
                </Triggers>
            </asp:UpdatePanel>
             </div>
            <div class="popup_Buttons" align="center">
                <asp:Button ID="btnProgramar" runat="server" Text="Nuevo Espectáculo" OnClick="btnProgramar_Click" />
                <input id="btnCancel" type="button" value="Cancelar" />
            </div>
        </div>
       
    </asp:Panel>
    <asp:Button ID="btnCargarGrid" runat="server" Text="cargar" Style="display: none"
        OnClick="btnCargarGrid_Click" />
    <script language="javascript" type="text/javascript">

        function openModal(val, tipo) {

            document.getElementById('<%=lblTitulo.ClientID%>').innerText = "Espectáculos Programados " + val;
            document.getElementById('<%=hdFecha.ClientID%>').value = val;

            if (tipo == '1') {
                document.getElementById('<%=lblVal.ClientID%>').innerText = '';
                document.getElementById('<%=btnProgramar.ClientID%>').style.display = 'inline';

            } else if (tipo == '0') {
                document.getElementById('<%=lblVal.ClientID%>').innerText = 'No se permite programar en esta fecha.';
                document.getElementById('<%=btnProgramar.ClientID%>').style.display = 'none';
            }

            document.getElementById('<%=btnCargarGrid.ClientID%>').click();

            ShowPopup();

        }

        function ShowPopup() {
            $find('<%=mpeProgView.ClientID%>').show();
        }

        function HidePopup() {
            $find('<%=mpeProgView.ClientID%>').hide();
        }

        
    </script>
</asp:Content>

